package com.zzyl.nursing.Test;

import com.baidubce.qianfan.Qianfan;
import com.baidubce.qianfan.core.auth.Auth;
import com.baidubce.qianfan.model.chat.ChatResponse;

public class QFanTest {
    public static void main(String[] args) {
        Qianfan qianfan = new Qianfan(Auth.TYPE_OAUTH,"XWHm2SAtlDUhBM355C1gxVlm",
                "L2eGFo5VwesHAQeoKbwCHqOUBkdCWES9");
        String prompt = "帮我写一本查理九世";
        ChatResponse response = qianfan.chatCompletion()
                .model("ERNIE-4.0-8K")//模型名称
                .addMessage("user",prompt)//聊天内容
//                .temperature(0.7)//采样参数 取值范围(0,7]
//                .maxOutputTokens(2000)//模型输出最大长度 取值范围[2,2000]
//                .responseFormat("text")//模型输出格式
               .execute();
        String result = response.getResult();
        System.out.println(result);
    }
}
